from django.db import models

# Create your models here.
from utils.basemodels import BaseModel
class Nav(BaseModel):
    name=models.CharField(max_length=100,verbose_name='导航名称')
    position=models.BooleanField(default=True,verbose_name='导航位置')
    link=models.CharField(max_length=100,verbose_name='导航顺序',blank=True,null=True)
    class Meta:
        db_table='Nav'
    def __str__(self):
        return self.name
class Banner(BaseModel):
    imgurl=models.CharField(max_length=100)
    link=models.CharField(max_length=100,verbose_name='连接',blank=True,null=True)
    class Meta:
        db_table='Banner'
class Category(BaseModel):
    name=models.CharField(max_length=100,verbose_name='分类名称')
    parent=models.ForeignKey('self',on_delete=models.CASCADE,null=True,blank=True,related_name='children')
    is_home=models.BooleanField(default=True,verbose_name='是否首页显示')
    is_hot=models.BooleanField(default=False,verbose_name='是否热门')
    is_good=models.BooleanField(default=False,verbose_name='是否精品')
    class Meta:
        db_table='Category'
    def __str__(self):
        return self.name